﻿using D.Medicalcare.ErrorCode;
using D.Medicalcare.Write.API.Application.Commands.PhysicalexaminationCommand;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace D.Medicalcare.Write.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class PhysicalexaminationController : ControllerBase
    {

        private readonly IMediator   mediator;

        public PhysicalexaminationController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 预约体检
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> AddPhysicalexamination(AddPhysicalexaminationCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        
        
        }
        /// <summary>
        /// 修改备注
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// 
        [HttpPost]
        public async Task<APIResult<int>> UpdatePhysicalexamination(UpdatePhysicalexaminationCommand request, CancellationToken cancellationToken)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }


        }



        }
}
